function User(name, age) {
  this.age = age
  this.name = name
  User.users.push(this)
}

User.users = []
User.total = function () {
  return this.users.length
}

User.prototype = Object.assign(User.prototype, {
  getAllUser() {
    return User.users
  },
  get users() {
    return User.users
  },
})

const lisi = new User('李四')
const wangwu = new User('王五')
const zhangshan = new User('张三')

// console.log(User.total())
// console.log(lisi.users.length)
// console.dir(User)
// let a = { name: '小美' }
// let b = Object.assign(a, { name: '小花' })
// let b = { ...a, name: '小花' }
// console.log(b)
